package cn.hongwei.controller.api;

import cn.hongwei.result.R;
import cn.hongwei.service.MediaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
* 给用户使用的播放控制器
* */
@RestController
@CrossOrigin
@RequestMapping("/api/vod/media")
public class ApiMediaController {
    @Autowired
    MediaService mediaService;

    //2、获取播放地址
    @GetMapping("getPlayUrl/{vId}")
    public R getPlayUrl(@PathVariable String vId){
        String playUrl = mediaService.getPlayUrl(vId);
        return R.ok().data("playUrl" , playUrl);
    }
    //3、获取播放凭证
    @GetMapping("getPlayAuth/{vId}")
    public R getPlayAuth(@PathVariable String vId){
        String playAuth = mediaService.getPlayAuth(vId);
        return R.ok().data("playAuth", playAuth);
    }
}
